<!-- LOGO -->
<div class="sidebar-header bg-primary">
  <div class="p-4">
    <%= link_to image_tag("logo-icon-white.svg"), main_app.admin_dashboard_path, class: "top-logo-icon" %>
    <%= link_to image_tag("logo-white.png"), main_app.admin_dashboard_path, class: "top-logo" %>
  </div>
</div>

<div class="sidebar-content has-scrollbar position-relative">

  <!--  PROFILE -->
  <div class="bg-dark">
    <div class="user-name">
      <div class="d-flex justify-content-between p-4">
        <div class="col-3 d-flex align-items-center pr-1 pl-0">
          <%= image_tag "default-profile.png", class: "img-fluid rounded-circle" %>
        </div>
        <div class="col d-flex align-items-center">
          <div>
            <h2 class="h5 m-0"><%= current_user.email.truncate(12) %></h2>
            <% if is_admin? %>
            <h3 class="h6 text-muted mt-1 mb-0">Administrator</h3>
            <% end %>
          </div>
        </div>
      </div>
    </div>
  </div>

  <!-- NAVIGATION -->
  <div>
    <ul class="list-icon sidebar-menu">

      <li class="list-icon-item <%= check_active('dashboard') %>">
        <%= link_to main_app.admin_dashboard_path do %>
        <i class="icon fa fa-tachometer-alt"></i>
        <span class="menu-text"><%= t('header.dashboard') %></span>
        <% end %>
      </li>

      <% if can? :manage, Blockchain %>
        <li class="list-icon-item <%= check_active('blockchains') %>">
          <%= link_to admin_blockchains_path do %>
            <i class="icon fa fa-link"></i>
            <span class="menu-text">Blockchains</span>
          <% end %>
        </li>
      <% end %>

      <li class="list-icon-item <%= check_active('currencies') %>">
        <%= link_to admin_currencies_path do %>
          <i class="icon fa fa-dollar-sign"></i>
          <span class="menu-text">Currencies</span>
        <% end %>
      </li>

      <% if can? :manage, Market %>
        <li class="list-icon-item <%= check_active('markets') %>">
          <%= link_to admin_markets_path do %>
            <i class="icon fa fa-chart-line"></i>
            <span class="menu-text">Markets</span>
          <% end %>
        </li>
      <% end %>

      <% if can? :manage, Wallet %>
        <li class="list-icon-item <%= check_active('wallets') %>">
          <%= link_to admin_wallets_path do %>
            <i class="icon fa fa-money-bill-wave"></i>
            <span class="menu-text">Wallets</span>
          <% end %>
        </li>
      <% end %>

      <% if can? :menu, Deposit %>
        <li class="list-icon-item <%= check_active('deposits') %>">
          <%= link_to "javascript:void(0);", class: 'has-arrow waves-effect waves-dark has-sub-menu', 'aria-expanded': 'false', data: {toggle: 'popover'} do %>
            <i class="icon fa fa-level-up-alt"></i>
            <span class="menu-text"><%= t('admin_header.deposits') %></span>
          <% end %>
          <div class="sub-menu hidden">
            <ul class="list-unstyled list-menu mb-0">
              <% Currency.ordered.codes.each do |c| %>
                <li><%= link_to c.upcase, admin_deposit_index_path(c) %></li>
              <% end %>
            </ul>
          </div>
        </li>
      <% end %>

      <% if can? :menu, Withdraw %>
        <li class="list-icon-item <%= check_active('withdraws') %>">
          <%= link_to "javascript:void(0);", class: 'has-arrow waves-effect waves-dark has-sub-menu', 'aria-expanded': "false", data: { toggle: 'popover' } do %>
            <i class="icon fa fa-level-down-alt"></i>
            <span class="menu-text"><%= t('admin_header.withdraws') %></span>
          <% end %>
          <div class="sub-menu hidden">
            <ul class="list-unstyled list-menu mb-0">
              <% Currency.ordered.codes.each do |c| %>
                <li><%= link_to c.upcase, admin_withdraw_index_path(c) %></li>
              <% end %>
            </ul>
          </div>
        </li>
      <% end %>

      <% if can? :manage, Member %>
        <li class="list-icon-item <%= check_active('members') %>">
          <%= link_to admin_members_path do %>
            <i class="icon fa fa-users"></i>
            <span class="menu-text"><%= t('.menus.sections.members') %></span>
          <% end %>
        </li>
      <% end %>

      <% if can? :menu, Operation %>
        <li class="list-icon-item <%= check_active('operations') %>">
          <%= link_to "javascript:void(0);", class: 'has-arrow waves-effect waves-dark has-sub-menu', 'aria-expanded': "false", data: { toggle: 'popover' } do %>
            <i class="icon fa fa-briefcase"></i>
            <span class="menu-text"><%= t('admin_header.operations') %></span>
          <% end %>
          <div class="sub-menu hidden">
            <ul class="list-unstyled list-menu mb-0">
              <% [:liability, :asset, :revenue, :expense].each do |o| %>
                <li><%= link_to o.to_s.upcase, send("admin_#{o.to_s}_operations_path") %></li>
              <% end %>
            </ul>
          </div>
        </li>

        <li class="list-icon-item <%= check_active('accountings') %>">
          <%= link_to "javascript:void(0);", class: 'has-arrow waves-effect waves-dark has-sub-menu', 'aria-expanded': "false", data: { toggle: 'popover' } do %>
            <i class="icon fa fa-balance-scale"></i>
            <span class="menu-text"><%= t('admin_header.accountings') %></span>
          <% end %>
          <div class="sub-menu hidden">
            <ul class="list-unstyled list-menu mb-0">
              <% [:balance_sheet, :income_statement].each do |o| %>
                <li><%= link_to o.to_s.humanize.upcase, eval("admin_#{o.to_s}_path") %></li>
              <% end %>
            </ul>
          </div>
        </li>
      <% end %>
    </ul>
  </div>
</div>
